<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>week02 作业</title>
</head>
<body>
    <div id="app"></div>
    <script type="module">
        import { render } from './core/render.js';
        const tmpl = `<div class="newslist">
            <div class="img" v-if="info.showImage"><img src="{{image}}"/></div>
            <div class="date" v-if="info.showDate">{{info.name}}</div>
            <div class="img">{{info.name}}</div>
            <div class="news-item" for="item in newslist" v-if="item.show">
                <div class="title">{{item.title}}</div>
                <div class="time">{{item.time}}</div>
            </div>
        </div>`;
        const dom = render(tmpl, {
            image: "https://img.yzcdn.cn/vant/cat.jpeg", 
            info: {showImage: true, showDate:false, name: "aaa"},
            newslist: [
                {
                    title: "新闻1",
                    time: "2021-07-11 10:00:32",
                    show: true
                },
                {
                    title: "新闻2",
                    time: "2021-07-12 10:00:32",
                    show: false
                },
                {
                    title: "新闻3",
                    time: "2021-07-12 10:00:32",
                    show: true
                },
                ]
        });
        document.querySelector('#app').appendChild(dom)
    </script>
</body>
</html>